﻿<Window x:Class="SampleApplication.WebCamPlayerWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit"
        xmlns:pl="clr-namespace:SampleApplication.Controls"
        Title="WebCam Player"
        Width="640"
        Height="700" Background="Black" >
    <Grid>
        <StackPanel>
            <pl:Planerator RotationY="{Binding ElementName=rotationSlider, Path=Value}"
                           Width="400"
                           Height="560">
                <StackPanel>
                    <Controls:VideoCaptureElement DesiredPixelWidth="320"
                                                  DesiredPixelHeight="240"
                                                  FPS="30"
                                                  Width="400"
                                                  Height="400"
                                                  VideoCaptureDevice="{Binding Path=SelectedItem, ElementName=videoCapDevices}"
                                                  x:Name="videoElement" Stretch="Fill" />
                    <Border Width="400"
                            Height="400">
                        <Border.Background>
                            <VisualBrush Visual="{Binding ElementName=videoElement}">
                                <VisualBrush.Transform>
                                    <ScaleTransform ScaleX="1"
                                                    ScaleY="-1"
                                                    CenterX="200"
                                                    CenterY="200"></ScaleTransform>
                                </VisualBrush.Transform>
                            </VisualBrush>
                        </Border.Background>
                        <Border.OpacityMask>
                            <LinearGradientBrush StartPoint="0,0"
                                                 EndPoint="0,1">
                                <GradientStop Offset="0"
                                              Color="#AA000000"></GradientStop>
                                <GradientStop Offset="0.35"
                                              Color="Transparent"></GradientStop>
                            </LinearGradientBrush>
                        </Border.OpacityMask>
                    </Border>
                </StackPanel>
            </pl:Planerator>
            <Slider Minimum="0"
                    Value="0"
                    Maximum="360"
                    x:Name="rotationSlider"
                    Style="{DynamicResource MediaTimeSliderStyle}" />
            <StackPanel Orientation="Horizontal">
                <ComboBox x:Name="videoCapDevices"
                          ItemsSource="{Binding Source={x:Static Controls:MultimediaUtil.VideoInputDevices}}"
                          DisplayMemberPath="Name"
                          Foreground="Black"
                          FontSize="20"
                          VerticalAlignment="Top"
                          Margin="0, 30, 0,0" />
                <Button Content="Properties"
                        Command="Controls:VideoCaptureElement.ShowPropertyPagesCommand" CommandTarget="{Binding ElementName=videoElement}" />
            </StackPanel>
            
        </StackPanel>
    </Grid>
</Window>
